package org.keyboardman.controller;

import org.keyboardman.model.User;
import org.keyboardman.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by longky on 2017/3/28.
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;


    @RequestMapping("user")
public User getUserById(long id){
   return  userService.getUserbyId(id);
}
    @RequestMapping("insert")
    public int addUser(String parm){
    User user=new User();
    user.setId(2l);
    user.setName("日天");
    user.setPassword("1");
    user.setStatus((short)0);
    user.setUsername("ritian");
    return userService.addUser(user);
    }


}

